# -*- coding:utf-8 -*-
__author__ = "zhl"

from EmQuantAPI import *
import common.mainApi as mp
import common.handler_date_time as df
from datetime import datetime,timedelta

def getDateOfCycle(start_date=None,end_date=None):
    """
    获取日期范围内的 股票交易周期数
    返回日期列表
    """
    if start_date is None:
        start_date="2020-01-01"
    if end_date is None:
        end_date=datetime.now().strftime('%Y-%m-%d')
    # 2021-03-14 10:06:37
    data=c.tradedates(start_date,end_date,"period=1,order=2,market=CNSESH")
    traddate_list=data.Data
    return traddate_list

def mainGetTradeDate(start_date=None,end_date=None):

    
    data=getDateOfCycle(start_date,end_date)
    
    return data

if __name__ == '__main__':
    mp.login()
    data=mainGetTradeDate(start_date='2021-03-08',end_date="2021-03-18")
    data=list(map(df.date_format_convert,data))
    print(data)
    mp.stop()
